home *** CD-ROM | disk | FTP | other *** search
- /*
- ** Apple Macintosh Developer Technical Support
- **
- ** Functions to help you build and sending Apple events to the Finder.
- **
- ** by Andy Bachorski, Apple Developer Technical Support
- **
- ** File: MoreFinderEvents.h
- **
- ** Version: 0.3.5
- **
- ** Copyright © 1996 Apple Computer, Inc.
- ** All rights reserved.
- **
- ** You may incorporate this sample code into your applications without
- ** restriction, though the sample code has been provided "AS IS" and the
- ** responsibility for its operation is 100% yours. However, what you are
- ** not permitted to do is to redistribute the source as "DSC Sample Code"
- ** after having made changes. If you're going to re-distribute the source,
- ** we require that you make it clear in the source that the code was
- ** descended from Apple Sample Code, but that you've made changes.
- */
-
- #ifndef MOREFINDEREVENTS
- #define MOREFINDEREVENTS
-
- // Prefix file
- #include "Prefix.h"
-
- // System includes
- #include <Aliases.h>
- #include <AppleScript.h>
- #include <Components.h>
- #include <Folders.h>
- #include <Icons.h>
- #include <OSA.h>
-
-
-
- enum {
- kFinderFileType = 'FNDR',
- kFinderCreatorType = 'MACS'
- };
-
-
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- PASCAL OSErr MFESetSelectionToNone( const AEIdleUPP idleProcUPP );
- /*
- Sets the Finder's selection to nothing by sending it an empty list.
- */
-
- // *****************************************************************************
-
- PASCAL OSErr MFEChangeFolderViewNewSuite( const FSSpecPtr fssPtr,
- const long viewStyle,
- const AEIdleUPP idleProcUPP );
- /*
- Given an FSSpec to a folder and a view constant value from the view by list
- defined in AERegistry.h, send an Apple event to the system 7.5.x Finder asking
- it to set the view of the folder's window to the specified style.
-
- Requires that the folder's window be open, otherwise an error is returned
- in the reply event.
-
- If your application will receive update event (i.e., it has windows), you must
- supply a more complete idle function than the simple idle function included
- with this library. It should pass any updated, activate, null, or osEvt events
- received to your application's do event routine.
- */
-
- // *****************************************************************************
- PASCAL OSErr MFEChangeFolderViewOldSuite( const FSSpecPtr fssPtr,
- const long viewStyle,
- const AEIdleUPP idleProcUPP );
- /*
- Given an FSSpec to a folder and a view constant value from the view by list
- defined in AERegistry.h, send an Apple event to the system 7.1.1/7.1.2 Finder
- asking it to set the view of the folder's window to the specified style.
-
- If your application will receive update event (i.e., it has windows), you must
- supply a more complete idle function than the simple idle function included
- with this library. It should pass any updated, activate, null, or osEvt events
- received to your application's do event routine.
- */
-
- // *****************************************************************************
-
- PASCAL OSErr MFEChangeFolderView( const FSSpecPtr fssPtr,
- const long viewStyle,
- const AEIdleUPP idleProcUPP );
- /*
- Given an FSSpec to a folder and a view constant value from the view by list
- defined in AERegistry.h, send an Apple event to the Finder asking it to set
- the view of the folder's window to the specified style.
-
- Requires that the folder's window be open, otherwise an error is returned
- in the reply event.
-
- If your application will receive update event (i.e., it has windows), you must
- supply a more complete idle function than the simple idle function included
- with this library. It should pass any updated, activate, null, or osEvt events
- received to your application's do event routine.
- */
-
- // *****************************************************************************
-
- PASCAL OSErr MFEAddCustomIconToItem( const FSSpecPtr fssPtr,
- const Handle theIconSuite,
- const IconSelectorValue iconSelector,
- const AEIdleUPP idleProcUPP );
-
- /*
- MFEAddCustomIconToItem adds a custom icon, via the Finder, to the item
- specified by the fssPtr.
- If an UPP to an idle function is provided in the idleProcUPP parameter,
- AESend is called with a send mode of kAEWaitReply. If idleProcUPP is set
- to nil, kAENoReply will be used for the send mode.
-
- fssPtr input: The item to add the custom icon to.
- theIconSuite input: The handle to the icon suite to install.
- iconSelector input: An IconSelectorValue specifying which icon types
- to add.
- idleProcUPP input: A UniversalProcPtr for an idle function, or nil.
-
- Result Codes
- _____________
- noErr 0 No error
- paramErr -50 The value of target or alias parameter, or of both,
- is NIL or odd, or the alias record is corrupt
- eLenErr -92 Buffer too big to send
- memFullErr -108 Not enough room in heap zone
- procNotFound -600 No eligible process with specified descriptor
- connectionInvalid -609 Nonexistent signature or session ID
- noUserInteractionAllowed -610 Background application sends event
- requiring authentication
- noPortErr -903 Client hasn’t set 'SIZE' resource to indicate
- awareness of high-level events
- destPortErr -906 Server hasn’t set 'SIZE' resource to indicate
- awareness of high-level events, or else is not present
- sessClosedErr -917 The kAEDontReconnect flag in the sendMode parameter
- was set and the server quit, then restarted
- errAECoercionFail -1700 Data could not be coerced to the
- requested Apple event data type
- errAEWrongDataType -1703 Wrong Apple event data type
- errAENotAEDesc -1704 Not a valid descriptor record
- errAEBadListItem -1705 Operation involving a list item failed
- errAEEventNotHandled -1708 Event wasn’t handled by an Apple event handler
- errAEUnknownSendMode -1710 Invalid sending mode was passed
- errAEWaitCanceled -1711 User canceled out of wait loop for reply or receipt
- errAETimeout -1712 Apple event timed out
- errAEUnknownAddressType -1716 Unknown Apple event address type
- Any error code returned by the event handler of the target application.
- ____________
- */
-
- // *****************************************************************************
-
- PASCAL OSErr MFEGetItemIcon( const FSSpecPtr fssPtr,
- const AEIdleUPP idleProcUPP,
- Handle *theIconSuite );
-
- /*
- MFEAddCustomIconToItem adds a custom icon, via the Finder, to the item
- specified by the fssPtr.
- If an UPP to an idle function is provided in the idleProcUPP parameter,
- AESend is called with a send mode of kAEWaitReply. If idleProcUPP is set
- to nil, kAENoReply will be used for the send mode.
-
- fssPtr input: The item to add the custom icon to.
- theIconSuite input: The handle to the icon suite to install.
- iconSelector input: An IconSelectorValue specifying which icon types
- to add.
- idleProcUPP input: A UniversalProcPtr for an idle function, or nil.
-
- Result Codes
- _____________
- noErr 0 No error
- paramErr -50 The value of target or alias parameter, or of both,
- is NIL or odd, or the alias record is corrupt
- eLenErr -92 Buffer too big to send
- memFullErr -108 Not enough room in heap zone
- procNotFound -600 No eligible process with specified descriptor
- connectionInvalid -609 Nonexistent signature or session ID
- noUserInteractionAllowed -610 Background application sends event
- requiring authentication
- noPortErr -903 Client hasn’t set 'SIZE' resource to indicate
- awareness of high-level events
- destPortErr -906 Server hasn’t set 'SIZE' resource to indicate
- awareness of high-level events, or else is not present
- sessClosedErr -917 The kAEDontReconnect flag in the sendMode parameter
- was set and the server quit, then restarted
- errAECoercionFail -1700 Data could not be coerced to the
- requested Apple event data type
- errAEWrongDataType -1703 Wrong Apple event data type
- errAENotAEDesc -1704 Not a valid descriptor record
- errAEBadListItem -1705 Operation involving a list item failed
- errAEEventNotHandled -1708 Event wasn’t handled by an Apple event handler
- errAEUnknownSendMode -1710 Invalid sending mode was passed
- errAEWaitCanceled -1711 User canceled out of wait loop for reply or receipt
- errAETimeout -1712 Apple event timed out
- errAEUnknownAddressType -1716 Unknown Apple event address type
- Any error code returned by the event handler of the target application.
- ____________
- */
-
- // *****************************************************************************
- PASCAL OSErr MFEGetEveryItemOnDesktop( const AEIdleUPP idleProcUPP,
- AEDescList *objectList );
- /* The MFEGetEveryItemOnDesktop function asks the Finder for a list of object
- descriptors for every item on the desktop (includes files, folders, and
- volumes).
- If an UPP to an idle function is provided in the idleProcUPP parameter,
- AESend is called with a send mode of kAEWaitReply. If idleProcUPP is set
- to nil, kAENoReply will be used for the send mode.
-
- idleProcUPP input: A UniversalProcPtr for an idle function, or nil.
- objectList input: A null AEDesc.
- iconSelector output: A list containing object descriptors,
- or a null AEDesc if an error is encountered.
-
- Result Codes
- _____________
- noErr 0 No error
- paramErr -50 The value of target or alias parameter, or of both,
- is NIL or odd, or the alias record is corrupt
- eLenErr -92 Buffer too big to send
- memFullErr -108 Not enough room in heap zone
- procNotFound -600 No eligible process with specified descriptor
- connectionInvalid -609 Nonexistent signature or session ID
- noUserInteractionAllowed -610 Background application sends event
- requiring authentication
- noPortErr -903 Client hasn’t set 'SIZE' resource to indicate
- awareness of high-level events
- destPortErr -906 Server hasn’t set 'SIZE' resource to indicate
- awareness of high-level events, or else is not present
- sessClosedErr -917 The kAEDontReconnect flag in the sendMode parameter
- was set and the server quit, then restarted
- errAECoercionFail -1700 Data could not be coerced to the
- requested Apple event data type
- errAEWrongDataType -1703 Wrong Apple event data type
- errAENotAEDesc -1704 Not a valid descriptor record
- errAEBadListItem -1705 Operation involving a list item failed
- errAEEventNotHandled -1708 Event wasn’t handled by an Apple event handler
- errAEUnknownSendMode -1710 Invalid sending mode was passed
- errAEWaitCanceled -1711 User canceled out of wait loop for reply or receipt
- errAETimeout -1712 Apple event timed out
- errAEUnknownAddressType -1716 Unknown Apple event address type
- Any error code returned by the event handler of the target application.
- ____________
- */
-
- // *****************************************************************************
-
- PASCAL OSErr MFEUpdateItemFSS( const FSSpecPtr fssPtr );
- /*
- Given an FSSpec to an item (file, folder, what ever), send an Apple event to
- the Finder asking it to update it's display of the item. For files, shows
- things like icon changes. For folders, shows things like new files that have
- been added.
- */
-
- // *****************************************************************************
-
- PASCAL OSErr MFEUpdateItemAlias( const AliasHandle aliasHandle );
- /*
- Given an alias to an item (file, folder, what ever), send an Apple event to
- the Finder asking it to update it's display of the item. For files, shows
- things like icon changes. For folders, shows things like new files that have
- been added.
- */
-
- // *****************************************************************************
-
- PASCAL OSErr MFEOpenFile( const AEIdleUPP idleProcUPP,
- FSSpec *fssPtr );
- /*
- Given an FSSpec to a file, send an open document event to the
- Finder, passing the FSSpec as the direct parameter.
- */
-
- #ifdef __cplusplus
- }
- #endif
-
- #ifndef COMPILING_MORE_FINDER_EVENTS
- #undef PASCAL
- #endif
-
-
- #endif//MOREFINDEREVENTS
-